package com.czxy.controller;

import com.czxy.service.SkuService;
import com.czxy.vo.OneSkuResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 张青卯
 */
@RestController
@RequestMapping
public class SkuController {

    private final SkuService skuService;

    @Autowired
    public SkuController(SkuService skuService) {
        this.skuService = skuService;
    }

    @GetMapping("/goods/{skuid}")
    public ResponseEntity<OneSkuResult> findCommentsByPage(@PathVariable("skuid") Integer skuid){
        OneSkuResult result = skuService.findSkuBySkuId(skuid);
        return ResponseEntity.ok(result);
    }
}
